﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FAST
{
    /**
     * For keeping track of persistent data
     * Original List will be serialzed into the text file.
     * */

    public class OriginalState
    {
        private string storagePath;
        private List<FilesHandler> orignalList;

        public OriginalState()
        {
            storagePath = "";//temp/default file to write path.
        }

        public OriginalState(string storagePath)
        {
            this.storagePath = storagePath;//developer specify file to write path.
        }
        
        public List<FilesHandler> getOriginalState()
        {
            Serializer ser = new Serializer();
            if (File.Exists(storagePath))
                this.orignalList = ser.deserializeObject(storagePath);
            else
                this.orignalList = null;

            return orignalList;
        }

        public void setOriginalState(List<FilesHandler> updatedList)
        {
            Serializer ser = new Serializer();
            ser.serializeObject(storagePath, updatedList);
        }

    }
}
